<!--
 * @Descripttion: 
 * @Version: 
 * @Author: gaohj
 * @Date: 2023-01-11 15:08:30
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-01-11 15:38:28
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button id="de" onclick="window.sessionStorage.removeItem('胜龙')">删除</button>
    <button id="de" onclick="window.sessionStorage.clear()">清空</button>
    <script>
        // window.sessionStorage.setItem('name','session张三');

        // window.sessionStorage.setItem('age',18); 
        // window.sessionStorage.setItem('hongbin','hongbinyyds'); 
        // window.sessionStorage.setItem('胜龙',JSON.stringify({name:'胜龙',age:21})); 

        // 基本类型可以存进去 但是最后取出来的是字符串类型
        // window.sessionStorage.setItem('isgoodgirl',true);

        // console.log(typeof window.localStorage.getItem('age'));
        // console.log(JSON.parse(window.sessionStorage.getItem('胜龙')));
        // window.sessionStorage.setItem('age',19); 
        // window.location.href = './test1.html';

        // 直接访问test1.html 获取不到sessionStorage
        // 如果是从这个页面跳转过去的test1.html  可以获取到sessionStorage
        window.sessionStorage.setItem('x',666); 
        window.sessionStorage.setItem('y',888); 
        window.sessionStorage.setItem('z',999); 
        // window.location.href = './test2.html';
    </script>
</body>
</html>